<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/5/30
 * Time: 16:14
 */

namespace App\LogicService;

use App\LogicService\Contracts\OphthalmologyOrdinaryLogicContract;
use App\Models\OphthalmologyOrdinary;


class OphthalmologyOrdinaryLogic extends BaseLogic implements OphthalmologyOrdinaryLogicContract
{
    public function update($record_id, $value)
    {
        $ophthalmologyOrdinary = OphthalmologyOrdinary::firstOrCreate(['record_id' => $record_id, 'inspect_type' => $value['inspect_type'], 'routine_type' => $value['routine_type']]);
        $ophthalmologyOrdinary->left = $value['left'];
        $ophthalmologyOrdinary->right = $value['right'];
        $ophthalmologyOrdinary->save();

        return $ophthalmologyOrdinary;
    }

    public function getList($record_id)
    {
        $ophthalmologyOrdinary = OphthalmologyOrdinary::where('record_id', $record_id)
            ->get()
            ->toArray();
        return $ophthalmologyOrdinary;
    }
}